import java.util.Objects;

/**
 * @author lcl
 * @DateTime 2024/10/30 0:55
 */
public abstract class Fruit {
    private int price;
    private double discount = 1;

    public Fruit() {
    }

    public Fruit(int price) {
        this.price = price;
    }

    public Fruit(int price, double discount) {
        this.price = price;
        this.discount = discount;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Fruit fruit = (Fruit) o;
        return price == fruit.price && Double.compare(discount, fruit.discount) == 0;
    }

    @Override
    public int hashCode() {
        return Objects.hash(price, discount);
    }
}
